package str

import (
	"strconv"
)

func Multiply(num1 string, num2 string) string {

	if num1 == "0" || num2 == "0" {
		return "0"
	}

	mul := []string{}

	for pos, v1 := range num2 {
		add := 0
		var str string = ""
		for i := len(num1) - 1; i >= 0; i-- {
			var temp int
			temp = int(num1[i]-'0')*int(v1-'0') + add
			str = strconv.Itoa(temp%10) + str
			add = temp / 10
		}
		if add > 0 {
			str = strconv.Itoa(add) + str
		}
		for i := 0; i < len(num2)-pos-1; i++ {
			str = str + "0"
		}
		mul = append(mul, str)
	}

	res := "0"

	for _, v := range mul {
		res = AddStrings(res, v)
	}

	return res

}
